//
//  NSArray+sortAndRemoveRepeat.h
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 BaseBusiness. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSArray (sortAndRemoveRepeat)

/**
 两个有序数组的去重与排序

 @param firstArr 老的数组
 @param secondArr 新的数组
 @param sortCompare 排序block 第一个参数 > 第二个参数 返回YES 降序  否则 升序
 @param repeatCompare 去重block 两个参数相等则重复 返回YES
 @return 排序后的新数组
 */
+ (NSMutableArray *)sortAndRemoveRepeatWithOldArr:(NSArray *)firstArr
                                           addArr:(NSArray *)secondArr
                                 sortCompareBlock:(BOOL (^)(id sA, id sB))sortCompare
                                    repeatCompare:(BOOL(^)(id rA, id rB))repeatCompare;

+ (NSMutableArray *)removeRepeatWithOldArr:(NSMutableArray *)firstArr
                                    addArr:(NSArray *)secondArr
                             repeatCompare:(BOOL(^)(id rA, id rB))repeatCompare;




/// 数组内去重
/// @param firstArr 数组1
/// @param secondArr 数组2
/// @param compareKey 去重对比的model对象key
+ (NSArray *)removeRepeatWithOldArr:(NSArray *)firstArr
                             addArr:(NSArray *)secondArr
                        compareDict:(NSString*(^)(id obj))compareKey;

@end
